package com.yyj.dao;

import com.yyj.entity.Dept;
import com.yyj.entity.DeptParams;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptDao {

    List<Dept> getDept();

    List<Dept> getBySearch(@Param("deptParams") DeptParams deptParams);

    @Insert("insert into dept (name,description) values (#{name },#{description})")
    void insertDept(Dept dept);

    @Update("update dept set name=#{name},description=#{description} where id=#{id}")
    void updateDept(Dept dept);

    @Delete("DELETE FROM dept WHERE id = #{id}")
    void deleteByPrimaryKey(Integer id);

    @Select("select * from dept where name=#{name}")
    Dept selectByName(@Param("name") String name);

    @Select("select * from dept where id=#{id}")
    Dept findById(Integer id);
}
